package pl.cezary.butler.walili.client.network;

/**
 *
 * @author czarek
 */
public class TrafficEntry implements Comparable<TrafficEntry> {
    private final long time;
    private final int size;

    public TrafficEntry(int size) {
        time = System.currentTimeMillis();
        this.size = size;
    }

    public int getSize() {
        return size;
    }

    public long getTime() {
        return time;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TrafficEntry other = (TrafficEntry) obj;
        if (this.time != other.time) {
            return false;
        }
        if (this.size != other.size) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 97 * hash + (int) (this.time ^ (this.time >>> 32));
        return hash;
    }

    @Override
    public int compareTo(TrafficEntry o) {
        return (int) (o.time - time);
    }

    
    
    
    
    
}
